//
//  MMDailyHearderView.m
//  zhihuDaily
//
//  Created by li  bo on 16/6/12.
//  Copyright © 2016年 cc. All rights reserved.
//

#import "MMDailyHearderView.h"


@interface MMDailyHearderView ()
@property (weak, nonatomic) IBOutlet UIImageView *rightView;
@property (weak, nonatomic) IBOutlet UILabel *title;


@property (strong, nonatomic) IBOutletCollection(UIImageView) NSArray<UIImageView *> *editorsImage;
@end
@implementation MMDailyHearderView


- (void)awakeFromNib {
    for (UIImageView *imageView in self.editorsImage) {
        CAShapeLayer *maskLayer = [CAShapeLayer layer];
        maskLayer.frame = imageView.bounds;
        maskLayer.path = [UIBezierPath bezierPathWithOvalInRect:CGRectInset(imageView.bounds, 2, 2)].CGPath;
        imageView.layer.mask = maskLayer;
    }
    self.dk_backgroundColorPicker = DKColorPickerWithKey(BG);
    self.title.dk_textColorPicker = DKColorPickerWithKey(TEXT);
}


- (void)setEditorIcons:(NSArray *)editorIcons
{
    _editorIcons = editorIcons;
    for (NSUInteger i = 0; i < 5; i++) {
        if (i < editorIcons.count) {
            [self.editorsImage[i] sd_setImageWithURL:[NSURL URLWithString:editorIcons[i]]];
        } else {
            self.editorsImage[i].image = nil;
        }
    }


}


+ (instancetype)DailyHearderView
{

    return [[[NSBundle mainBundle] loadNibNamed:NSStringFromClass([self class]) owner:nil options:nil] lastObject];

}

@end
